public void Test_CellDatumRequestArgument_ClusterCompute_CreationWithArgs() { Guid siteModelID = Guid.NewGuid(); DisplayMode mode = DisplayMode.MachineSpeed; XYZ neeCoords = new XYZ(12345.6789, 98765.4321); int otgCellX = 16234; int otgCellY = 55236; IFilterSet filters = new FilterSet(); var referenceDesign = new DesignOffset(Guid.NewGuid(), 12.34); var overrides = new OverrideParameters { OverrideMachineMDP = true, OverridingMachineMDP = 321 }; var arg = new CellDatumRequestArgument_ClusterCompute(siteModelID, mode, neeCoords, otgCellX, otgCellY, filters, referenceDesign, overrides, null); Assert.NotNull(arg); Assert.Equal(siteModelID, arg.ProjectID); Assert.Equal(mode, arg.Mode); Assert.Equal(neeCoords, arg.NEECoords); Assert.Equal(otgCellX, arg.OTGCellX); Assert.Equal(otgCellY, arg.OTGCellY); Assert.Equal(filters, arg.Filters); Assert.Equal(referenceDesign.DesignID, arg.ReferenceDesign.DesignID); Assert.Equal(referenceDesign.Offset, arg.ReferenceDesign.Offset); Assert.Equal(overrides.OverrideMachineMDP, arg.Overrides.OverrideMachineMDP); Assert.Equal(overrides.OverridingMachineMDP, arg.Overrides.OverridingMachineMDP); }
public async Task Test_CellDatumRequest_ClusterCompute_Execute_SingleCellSiteModelMinimalValues(DisplayMode mode) { AddApplicationGridRouting(); AddClusterComputeGridRouting(); AddDesignProfilerGridRouting(); var baseTime = DateTime.UtcNow; var siteModel = BuildModelForSingleCellDatum(baseTime, true); var designUid = DITAGFileAndSubGridRequestsWithIgniteFixture.ConstructSingleFlatTriangleDesignAboutOrigin(ref siteModel, 1.0f); var referenceDesign = new DesignOffset(designUid, 0); var request = new CellDatumRequest_ClusterCompute(); var arg = CreateCellDatumRequestArgument_ClusterCompute(siteModel, referenceDesign, mode, new OverrideParameters()); var response = await request.ExecuteAsync(arg, new SubGridSpatialAffinityKey(SubGridSpatialAffinityKey.DEFAULT_SPATIAL_AFFINITY_VERSION_NUMBER_TICKS, arg.ProjectID, arg.OTGCellX, arg.OTGCellY)); response.Should().NotBeNull(); //Only elevation and pass count var expected = CellDatumReturnCode.NoValueFound; switch (mode) { case DisplayMode.Height: case DisplayMode.CutFill: case DisplayMode.PassCount: case DisplayMode.PassCountSummary: expected = CellDatumReturnCode.ValueFound; break; } Assert.Equal(expected, response.ReturnCode); }
/// <summary> /// Performs the donkey work of the elevation patch calculation /// </summary> /// <returns>The computed elevation of the given design at the spot location, or NullDouble if the location does not lie on the design</returns> private double Calc(ISiteModelBase siteModel, DesignOffset referenceDesign, double spotX, double spotY, out DesignProfilerRequestResult calcResult) { calcResult = DesignProfilerRequestResult.UnknownError; var design = _designs.Lock(referenceDesign.DesignID, siteModel, SubGridTreeConsts.DefaultCellSize, out var lockResult); if (design == null) { _log.LogWarning($"Failed to read design file for design {referenceDesign.DesignID}"); calcResult = DesignProfilerRequestResult.FailedToLoadDesignFile; return(Common.Consts.NullDouble); } try { var hint = -1; if (design.InterpolateHeight(ref hint, spotX, spotY, referenceDesign.Offset, out var z)) { calcResult = DesignProfilerRequestResult.OK; } else { calcResult = DesignProfilerRequestResult.NoElevationsInRequestedPatch; z = Common.Consts.NullDouble; } return(z); }
/// <summary> /// Constructor for the renderer /// </summary> public RenderOverlayTile(Guid dataModelId, //AExternalDescriptor :TASNodeRequestDescriptor; DisplayMode mode, XYZ blPoint, XYZ trPoint, bool coordsAreGrid, ushort nPixelsX, ushort nPixelsY, IFilterSet filters, DesignOffset cutFillDesign, IPlanViewPalette aColorPalettes, Color representColor, Guid requestingTRexNodeId, ILiftParameters liftParams, VolumeComputationType volumeType ) { DataModelID = dataModelId; // ExternalDescriptor = AExternalDescriptor Mode = mode; BLPoint = blPoint; TRPoint = trPoint; CoordsAreGrid = coordsAreGrid; NPixelsX = nPixelsX; NPixelsY = nPixelsY; Filters = filters; CutFillDesign = cutFillDesign; ColorPalettes = aColorPalettes; RepresentColor = representColor; RequestingTRexNodeID = requestingTRexNodeId; LiftParams = liftParams; VolumeType = volumeType; }
protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item) { var request = item as DesignDataRequest; if (request == null) { ThrowRequestTypeCastException <DesignDataRequest>(); } var siteModel = GetSiteModel(request.ProjectUid); var alignmentDesignStationRangeRequest = new AlignmentDesignStationRangeRequest(); var referenceDesign = new DesignOffset(request.DesignUid, 0.0); var alignmentDesignStationRangeResponse = await alignmentDesignStationRangeRequest.ExecuteAsync(new DesignSubGridRequestArgumentBase() { ProjectID = siteModel.ID, ReferenceDesign = referenceDesign }); if (alignmentDesignStationRangeResponse != null && alignmentDesignStationRangeResponse.RequestResult == DesignProfilerRequestResult.OK) { return(new AlignmentStationRangeResult(alignmentDesignStationRangeResponse.StartStation, alignmentDesignStationRangeResponse.EndStation)); } throw new ServiceException(HttpStatusCode.BadRequest, new ContractExecutionResult(ContractExecutionStatesEnum.FailedToGetResults, "Failed to get requested Alignment Design station range data.")); }
[InlineData(DisplayMode.CutFill, 3.5, false)]//1.5 offset from 5 public async Task Test_CellDatumRequest_ClusterCompute_Execute_SingleCellSiteModelLastPass(DisplayMode mode, double expectedValue, bool withOverrides) { AddApplicationGridRouting(); AddClusterComputeGridRouting(); AddDesignProfilerGridRouting(); var baseTime = DateTime.UtcNow; var siteModel = BuildModelForSingleCellDatum(baseTime); var designUid = DITAGFileAndSubGridRequestsWithIgniteFixture.ConstructSingleFlatTriangleDesignAboutOrigin(ref siteModel, 1.0f); var referenceDesign = new DesignOffset(designUid, 1.5); var overrides = withOverrides ? new OverrideParameters { OverrideMachineCCV = true, OverridingMachineCCV = 440, OverrideMachineMDP = true, OverridingMachineMDP = 440, OverrideTargetPassCount = true, OverridingTargetPassCountRange = new PassCountRangeRecord(4, 8) //others not used in cell datum } : new OverrideParameters(); var request = new CellDatumRequest_ClusterCompute(); var arg = CreateCellDatumRequestArgument_ClusterCompute(siteModel, referenceDesign, mode, overrides); var response = await request.ExecuteAsync(arg, new SubGridSpatialAffinityKey(SubGridSpatialAffinityKey.DEFAULT_SPATIAL_AFFINITY_VERSION_NUMBER_TICKS, arg.ProjectID, arg.OTGCellX, arg.OTGCellY)); response.Should().NotBeNull(); Assert.Equal(CellDatumReturnCode.ValueFound, response.ReturnCode); Assert.Equal(expectedValue, response.Value); Assert.Equal(baseTime.AddMinutes(10), response.TimeStampUTC); }
public async Task Test_DesignBoundaryRequest() { const int EXPECTED_BOUNDARY_COUNT = 7; const int EXPECTED_BOUNDARY_POINTS_COUNT_0 = 1528; const int EXPECTED_BOUNDARY_POINTS_COUNT_2 = 15; const int EXPECTED_BOUNDARY_POINTS_COUNT = 6; AddDesignProfilerGridRouting(); var siteModel = DITAGFileAndSubGridRequestsWithIgniteFixture.NewEmptyModel(); var designUid = DITAGFileAndSubGridRequestsWithIgniteFixture.AddDesignToSiteModel(ref siteModel, TestHelper.CommonTestDataPath, "Bug36372.ttm", false); var referenceDesign = new DesignOffset(designUid, 0); var request = new DesignBoundaryRequest(); var response = await request.ExecuteAsync(new DesignBoundaryArgument() { ProjectID = siteModel.ID, ReferenceDesign = referenceDesign, Filters = new FilterSet(new CombinedFilter()), TRexNodeID = Guid.NewGuid() }); response.RequestResult.Should().Be(DesignProfilerRequestResult.OK); response.Boundary.Count.Should().Be(EXPECTED_BOUNDARY_COUNT); response.Boundary[0].Points.Count.Should().Be(EXPECTED_BOUNDARY_POINTS_COUNT_0); response.Boundary[1].Points.Count.Should().Be(EXPECTED_BOUNDARY_POINTS_COUNT); response.Boundary[2].Points.Count.Should().Be(EXPECTED_BOUNDARY_POINTS_COUNT_2); response.Boundary[3].Points.Count.Should().Be(EXPECTED_BOUNDARY_POINTS_COUNT); response.Boundary[4].Points.Count.Should().Be(EXPECTED_BOUNDARY_POINTS_COUNT); response.Boundary[5].Points.Count.Should().Be(EXPECTED_BOUNDARY_POINTS_COUNT); response.Boundary[6].Points.Count.Should().Be(EXPECTED_BOUNDARY_POINTS_COUNT); }
protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item) { var request = item as DesignProfileRequest; if (request == null) { ThrowRequestTypeCastException <DesignProfileRequest>(); } var siteModel = GetSiteModel(request.ProjectUid); var designProfileRequest = new VSS.TRex.Designs.GridFabric.Requests.DesignProfileRequest(); var referenceDesign = new DesignOffset(request.DesignUid, request.Offset); var designProfileResponse = await designProfileRequest.ExecuteAsync(new CalculateDesignProfileArgument { ProjectID = siteModel.ID, ReferenceDesign = referenceDesign, CellSize = siteModel.CellSize, StartPoint = new WGS84Point(request.StartX, request.StartY, request.PositionsAreGrid ? Consts.NullDouble : 0),//coord conversion requires elevation set EndPoint = new WGS84Point(request.EndX, request.EndY, request.PositionsAreGrid ? Consts.NullDouble : 0), PositionsAreGrid = request.PositionsAreGrid }); if (designProfileResponse != null) { return(ConvertResult(designProfileResponse)); } throw new ServiceException(HttpStatusCode.BadRequest, new ContractExecutionResult(ContractExecutionStatesEnum.FailedToGetResults, "Failed to get requested Design Profile data")); }
/// <summary> /// Serializes content from the writer /// </summary> public override void InternalFromBinary(IBinaryRawReader reader) { base.InternalFromBinary(reader); var version = VersionSerializationHelper.CheckVersionByte(reader, VERSION_NUMBER); if (version == 1) { ProjectID = reader.ReadGuid() ?? Guid.Empty; VolumeType = (VolumeComputationType)reader.ReadInt(); BaseFilter = ReadFilter(reader); TopFilter = ReadFilter(reader); if (reader.ReadBoolean()) { BaseDesign = new DesignOffset(); BaseDesign.FromBinary(reader); } if (reader.ReadBoolean()) { TopDesign = new DesignOffset(); TopDesign.FromBinary(reader); } AdditionalSpatialFilter = ReadFilter(reader); CutTolerance = reader.ReadDouble(); FillTolerance = reader.ReadDouble(); } }
public async Task Test_AlignmentDesignFilterBoundaryRequest() { const double START_STATION = 0.0; const double END_STATION = 100.0; const double LEFT_OFFSET = 1.0; const double RIGHT_OFFSET = 2.0; AddDesignProfilerGridRouting(); var siteModel = DITAGFileAndSubGridRequestsWithIgniteFixture.NewEmptyModel(); var designUid = DITAGFileAndSubGridRequestsWithIgniteFixture.AddSVLAlignmentDesignToSiteModel(ref siteModel, TestHelper.CommonTestDataPath, "Large Sites Road - Trimble Road.svl"); var referenceDesign = new DesignOffset(designUid, 0); var request = new AlignmentDesignFilterBoundaryRequest(); var response = await request.ExecuteAsync(new AlignmentDesignFilterBoundaryArgument { ProjectID = siteModel.ID, ReferenceDesign = referenceDesign, Filters = new FilterSet(new CombinedFilter()), TRexNodeID = Guid.NewGuid(), StartStation = START_STATION, EndStation = END_STATION, LeftOffset = LEFT_OFFSET, RightOffset = RIGHT_OFFSET }); // TODO To complete this test later once an alignment filter boundary implementation becomes available on a .Net standard version of the Symphony SDK response.RequestResult.Should().Be(DesignProfilerRequestResult.OK); }
[InlineData(247680.000 + 100, 193054.000, Consts.NullDouble, 100.1)] // Outside of surface so returns NullDouble public async Task Test_DesignElevationSpotRequest_EmptySiteModel_SpotLookup_WithOffset(double spotX, double spotY, double expectedHeight, double offset) { AddDesignProfilerGridRouting(); var siteModel = DITAGFileAndSubGridRequestsWithIgniteFixture.NewEmptyModel(); var designUid = DITAGFileAndSubGridRequestsWithIgniteFixture.AddDesignToSiteModel(ref siteModel, TestHelper.CommonTestDataPath, "Bug36372.ttm", false); var referenceDesign = new DesignOffset(designUid, offset); var request = new DesignElevationSpotRequest(); var response = await request.ExecuteAsync(new CalculateDesignElevationSpotArgument { ProjectID = siteModel.ID, ReferenceDesign = referenceDesign, SpotX = spotX, SpotY = spotY, }); if (expectedHeight == Consts.NullDouble) { response.CalcResult.Should().Be(DesignProfilerRequestResult.NoElevationsInRequestedPatch); response.Elevation.Should().Be(Consts.NullDouble); } else { response.CalcResult.Should().Be(DesignProfilerRequestResult.OK); response.Elevation.Should().BeApproximately(expectedHeight + offset, 0.001); } }
/// <summary> /// Constructor /// </summary> public SubGridRequestsBase(ITRexTask tRexTask, Guid siteModelID, Guid requestID, Guid trexNodeId, GridDataType requestedGridDataType, bool includeSurveyedSurfaceInformation, ISubGridTreeBitMask prodDataMask, ISubGridTreeBitMask surveyedSurfaceOnlyMask, IFilterSet filters, DesignOffset referenceDesign, AreaControlSet areaControlSet, Action <TSubGridsRequestArgument> customArgumentInitializer, SubGridsRequestComputeStyle subGridsRequestComputeStyle) : this() { TRexTask = tRexTask; SiteModelID = siteModelID; RequestID = requestID; TRexNodeId = trexNodeId; RequestedGridDataType = requestedGridDataType; IncludeSurveyedSurfaceInformation = includeSurveyedSurfaceInformation; ProdDataMask = prodDataMask; SurveyedSurfaceOnlyMask = surveyedSurfaceOnlyMask; Filters = filters; ReferenceDesign = referenceDesign; AreaControlSet = areaControlSet; CustomArgumentInitializer = customArgumentInitializer; SubGridsRequestComputeStyle = SubGridsRequestComputeStyle; }
protected override async Task<ContractExecutionResult> ProcessAsyncEx<T>(T item) { var request = item as DesignFilterBoundaryRequest; if (request == null) ThrowRequestTypeCastException<DesignFilterBoundaryRequest>(); var siteModel = GetSiteModel(request.ProjectUid); var designFilterBoundaryRequest = new AlignmentDesignFilterBoundaryRequest(); var referenceDesign = new DesignOffset(request.DesignUid, 0.0); var designFilterBoundaryResponse = await designFilterBoundaryRequest.ExecuteAsync(new AlignmentDesignFilterBoundaryArgument() { ProjectID = siteModel.ID, ReferenceDesign = referenceDesign, StartStation = request.StartStation, EndStation = request.EndStation, LeftOffset = request.LeftOffset, RightOffset = request.RightOffset }); if (designFilterBoundaryResponse != null && designFilterBoundaryResponse.RequestResult != DesignProfilerRequestResult.OK && designFilterBoundaryResponse.Boundary != null) return ConvertResult(designFilterBoundaryResponse.Boundary); throw new ServiceException(HttpStatusCode.BadRequest, new ContractExecutionResult(ContractExecutionStatesEnum.FailedToGetResults, "Failed to get requested Design Filter Boundary data")); }
/// <summary> /// Constructor /// </summary> /// <param name="startDate">The date at which to start calculating progressive sub grids</param> /// <param name="endDate">The date beyond which no further progressive sub grids will be calculated</param> /// <param name="interval">The time interval between successive calculations of progressive sub grids</param> public ComputeProgressiveVolumes_Coordinator(Guid siteModelId, ILiftParameters liftParams, VolumeComputationType volumeType, ICombinedFilter filter, DesignOffset baseDesign, DesignOffset topDesign, ICombinedFilter additionalSpatialFilter, double cutTolerance, double fillTolerance, DateTime startDate, DateTime endDate, TimeSpan interval) { SiteModelID = siteModelId; VolumeType = volumeType; Filter = filter; _baseDesign = baseDesign; _topDesign = topDesign; AdditionalSpatialFilter = additionalSpatialFilter; CutTolerance = cutTolerance; FillTolerance = fillTolerance; _liftParams = liftParams; StartDate = startDate; EndDate = endDate; Interval = interval; }
/// <summary> /// Constructs the context of a pipelined processor based on the project, filters and other common criteria /// of pipelined requests /// </summary> /// <param name="requestDescriptor"></param> /// <param name="dataModelID"></param> /// <param name="gridDataType"></param> /// <param name="response"></param> /// <param name="filters"></param> /// <param name="cutFillDesign"></param> /// <param name="task"></param> /// <param name="pipeline"></param> /// <param name="requestAnalyser"></param> /// <param name="requireSurveyedSurfaceInformation"></param> /// <param name="requestRequiresAccessToDesignFileExistenceMap"></param> /// <param name="overrideSpatialCellRestriction">A restriction on the cells that are returned via the query that intersects with the spatial selection filtering and criteria</param> /// <param name="liftParams"></param> public PipelineProcessor(Guid requestDescriptor, Guid dataModelID, GridDataType gridDataType, ISubGridsPipelinedReponseBase response, IFilterSet filters, DesignOffset cutFillDesign, ITRexTask task, ISubGridPipelineBase pipeline, IRequestAnalyser requestAnalyser, bool requireSurveyedSurfaceInformation, bool requestRequiresAccessToDesignFileExistenceMap, BoundingIntegerExtent2D overrideSpatialCellRestriction, ILiftParameters liftParams) { RequestDescriptor = requestDescriptor; DataModelID = dataModelID; GridDataType = gridDataType; Response = response; Filters = filters; CutFillDesign = cutFillDesign; Task = task; Pipeline = pipeline; RequestAnalyser = requestAnalyser; RequireSurveyedSurfaceInformation = requireSurveyedSurfaceInformation; RequestRequiresAccessToDesignFileExistenceMap = requestRequiresAccessToDesignFileExistenceMap; OverrideSpatialCellRestriction = overrideSpatialCellRestriction; LiftParams = liftParams; }
/// <summary> /// Constructs the context of a pipelined processor based on the project, filters and other common criteria /// of pipelined requests /// </summary> /// <param name="overrideSpatialCellRestriction">A restriction on the cells that are returned via the query that intersects with the spatial selection filtering and criteria</param> public IPipelineProcessor NewInstance <TSubGridsRequestArgument>(Guid requestDescriptor, Guid dataModelID, GridDataType gridDataType, ISubGridsPipelinedReponseBase response, IFilterSet filters, DesignOffset cutFillDesign, ITRexTask task, ISubGridPipelineBase pipeline, IRequestAnalyser requestAnalyser, bool requireSurveyedSurfaceInformation, bool requestRequiresAccessToDesignFileExistenceMap, BoundingIntegerExtent2D overrideSpatialCellRestriction, ILiftParameters liftParams) { var pipelineProcessor = NewInstanceNoBuild <TSubGridsRequestArgument> (requestDescriptor, dataModelID, gridDataType, response, filters, cutFillDesign, task, pipeline, requestAnalyser, requireSurveyedSurfaceInformation, requestRequiresAccessToDesignFileExistenceMap, overrideSpatialCellRestriction, liftParams); if (!pipelineProcessor.Build()) { Log.LogError($"Failed to build pipeline processor for request to model {dataModelID}"); pipelineProcessor = null; } return(pipelineProcessor as IPipelineProcessor); }
[InlineData(247680.000 + 100, 193054.000, Consts.NullDouble, 100.1, false)] // Outside of surface so returns NullDouble public async Task Test_DesignElevationPatchRequest_WithOffset(double spotX, double spotY, double expectedHeight, double offset, bool patchExists) { AddDesignProfilerGridRouting(); var siteModel = DITAGFileAndSubGridRequestsWithIgniteFixture.NewEmptyModel(); var designUid = DITAGFileAndSubGridRequestsWithIgniteFixture.AddDesignToSiteModel(ref siteModel, TestHelper.CommonTestDataPath, "Bug36372.ttm", false); var referenceDesign = new DesignOffset(designUid, 0); // Get the cell location of the probe position. Note that the request will return the sub grid // that contains this cell, so the origin location of the sub grid may not be the same as the cell location // siteModel.Grid.CalculateIndexOfCellContainingPosition(spotX, spotY, out int cellX, out int cellY); var request = new DesignElevationPatchRequest(); var argument = new CalculateDesignElevationPatchArgument { ProjectID = siteModel.ID, ReferenceDesign = referenceDesign, CellSize = siteModel.CellSize, Filters = new FilterSet(new CombinedFilter()), OriginX = cellX, OriginY = cellY }; var response = await request.ExecuteAsync(argument); response.Should().NotBeNull(); response.CalcResult.Should().Be(patchExists ? DesignProfilerRequestResult.OK : DesignProfilerRequestResult.NoElevationsInRequestedPatch); if (patchExists) { response.Heights.CellSize.Should().Be(siteModel.CellSize); response.Heights.GridDataType.Should().Be(GridDataType.Height); response.Heights.Level.Should().Be(siteModel.Grid.NumLevels); response.Heights.OriginX.Should().Be((int)(cellX & ~SubGridTreeConsts.SubGridLocalKeyMask)); response.Heights.OriginY.Should().Be((int)(cellY & ~SubGridTreeConsts.SubGridLocalKeyMask)); response.Heights.Owner.Should().BeNull(); response.Heights.Parent.Should().BeNull(); response.Heights.Cells.Should().NotBeNull(); } else { response.Heights.Should().BeNull(); } if (patchExists) { // Check a request with an offset provides the expected answer argument.ReferenceDesign.Offset = offset; var response2 = await request.ExecuteAsync(argument); response2.Should().NotBeNull(); response2.CalcResult.Should().Be(DesignProfilerRequestResult.OK); response2.Heights.Should().NotBeNull(); response2.Heights.ForEach((x, y) => response2.Heights.Cells[x, y].Should().BeApproximately((float)(response.Heights.Cells[x, y] + offset), TestHelper.ALLOWED_HEIGHT_TOLERANCE_AS_FLOAT)); } }
/// <summary> /// Constructor taking the full state of the elevation patch computation operation /// </summary> /// <param name="siteModelID"></param> /// <param name="spotX"></param> /// <param name="spotY"></param> /// <param name="referenceDesign"></param> public CalculateDesignElevationSpotArgument(Guid siteModelID, double spotX, double spotY, DesignOffset referenceDesign) : base(siteModelID, referenceDesign) { SpotX = spotX; SpotY = spotY; }
/// <summary> /// Constructor taking the full state of the elevation patch computation operation /// </summary> public CalculateDesignElevationPatchArgument(Guid siteModelID, int originX, int originY, double cellSize, DesignOffset referenceDesign) : base(siteModelID, referenceDesign) { OriginX = originX; OriginY = originY; CellSize = cellSize; }
/// <summary> /// Constructor taking the full state of the elevation patch computation operation /// </summary> /// <param name="siteModelID"></param> /// <param name="originX"></param> /// <param name="originY"></param> /// <param name="referenceSurface"></param> public DesignSubGridFilterMaskArgument(Guid siteModelID, int originX, int originY, DesignOffset referenceSurface, double cellSize) : base(siteModelID, referenceSurface) { OriginX = originX; OriginY = originY; CellSize = cellSize; }
/// <summary> /// Constructs the profile analysis executor /// </summary> public ComputeProfileExecutor_ClusterCompute(ProfileStyle profileStyle, Guid projectID, GridDataType profileTypeRequired, XYZ[] nEECoords, IFilterSet filters, // externalRequestDescriptor: TASNodeRequestDescriptor; DesignOffset design, bool returnAllPassesAndLayers, VolumeComputationType volumeType, IOverrideParameters overrides, ILiftParameters liftParams) { ProfileStyle = profileStyle; ProjectID = projectID; ProfileTypeRequired = profileTypeRequired; NEECoords = nEECoords; Filters = filters; Design = design; VolumeType = volumeType; Overrides = overrides; LiftParams = liftParams; }
public CellDatumRequestArgument_ApplicationService( Guid siteModelID, DisplayMode mode, bool coordsAreGrid, XYZ point, IFilterSet filters, DesignOffset referenceDesign, IOverrideParameters overrides) { ProjectID = siteModelID; Mode = mode; CoordsAreGrid = coordsAreGrid; Point = point; Filters = filters; ReferenceDesign = referenceDesign; Overrides = overrides; }
protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item) { var request = item as SummaryVolumesProfileDataRequest; if (request == null) { ThrowRequestTypeCastException <SummaryVolumesProfileDataRequest>(); } var siteModel = GetSiteModel(request.ProjectUid); var baseFilter = ConvertFilter(request.Filter, siteModel); var topFilter = ConvertFilter(request.TopFilter, siteModel); var referenceDesign = new DesignOffset(request.ReferenceDesignUid ?? Guid.Empty, request.ReferenceDesignOffset ?? 0); var arg = new ProfileRequestArgument_ApplicationService { ProjectID = request.ProjectUid, ProfileTypeRequired = GridDataType.Height, ProfileStyle = ProfileStyle.SummaryVolume, PositionsAreGrid = request.PositionsAreGrid, Filters = new FilterSet(baseFilter, topFilter), ReferenceDesign = referenceDesign, StartPoint = new WGS84Point(lon: request.StartX, lat: request.StartY, request.PositionsAreGrid ? Consts.NullDouble : 0),//coord conversion requires elevation set EndPoint = new WGS84Point(lon: request.EndX, lat: request.EndY, request.PositionsAreGrid ? Consts.NullDouble : 0), ReturnAllPassesAndLayers = false, VolumeType = ConvertVolumesHelper.ConvertVolumesType(request.VolumeCalcType), Overrides = AutoMapperUtility.Automapper.Map <OverrideParameters>(request.Overrides), LiftParams = ConvertLift(request.LiftSettings, request.Filter?.LayerType) }; // Compute a profile from the bottom left of the screen extents to the top right var svRequest = new ProfileRequest_ApplicationService_SummaryVolumeProfileCell(); var response = await svRequest.ExecuteAsync(arg); if (response != null) { return(ConvertResult(response)); } throw new ServiceException(HttpStatusCode.BadRequest, new ContractExecutionResult(ContractExecutionStatesEnum.FailedToGetResults, "Failed to get requested Summary Volumes Profile data")); }
public async Task Test_CutFillTile_TAGFile_FlatDesign(ElevationSource elevationSource, bool useSmoothing, ConvolutionMaskSize maskSize, NullInfillMode nullInfillMode) { AddApplicationGridRouting(); AddClusterComputeGridRouting(); AddDesignProfilerGridRouting(); _fixture.smoothingActive = useSmoothing; _fixture.smootherMaskSize = maskSize; _fixture.smootherNullInfillMode = nullInfillMode; // Construct a site model from a single TAG file var tagFiles = new[] { Path.Combine(TestHelper.CommonTestDataPath, "TestTAGFile.tag") }; var siteModel = DITAGFileAndSubGridRequestsFixture.BuildModel(tagFiles, out _); // Add a flat design to the site model at the minimum elevation in the site model var elevation = elevationSource switch { ElevationSource.MinimumElevation => (float)siteModel.SiteModelExtent.MinZ, ElevationSource.MaximumElevation => (float)siteModel.SiteModelExtent.MaxZ, _ => (float)siteModel.SiteModelExtent.MinZ }; var designUid = DITAGFileAndSubGridRequestsWithIgniteFixture.ConstructFlatTTMDesignEncompassingSiteModel(ref siteModel, elevation); var referenceDesign = new DesignOffset(designUid, 0.0); var palette = PVMPaletteFactory.GetPalette(siteModel, DisplayMode.CutFill, siteModel.SiteModelExtent); var request = new TileRenderRequest(); var arg = SimpleTileRequestArgument(siteModel, DisplayMode.CutFill, palette, volumeType: VolumeComputationType.BetweenFilterAndDesign); // Add the cut/fill design reference to the request, and set the rendering extents to the cell in question, // with an additional 1 meter border around the cell arg.ReferenceDesign = referenceDesign; arg.Extents = siteModel.SiteModelExtent; arg.Extents.Expand(1.0, 1.0); var response = await request.ExecuteAsync(arg); var fileName = @$ "Flat-Elevation-{elevation}-Smoothing-{useSmoothing}-{maskSize}-{nullInfillMode}.bmp"; var path = Path.Combine("TestData", "RenderedTiles", "CutFillTile", fileName); var saveFileName = ""; // @$"C:\Temp\Flat-Elevation-{elevation}-Smoothing-{useSmoothing}-{maskSize}-{nullInfillMode}.bmp"; CheckSimpleRenderTileResponse(response, DisplayMode.CutFill, saveFileName, path); }
/// <summary> /// Constructs the context of a pipelined processor based on the project, filters and other common criteria /// of pipelined requests, but does not perform the build action on the pipeline processor /// </summary> /// <param name="overrideSpatialCellRestriction">A restriction on the cells that are returned via the query that intersects with the spatial selection filtering and criteria</param> public IPipelineProcessor NewInstanceNoBuild <TSubGridsRequestArgument>(Guid requestDescriptor, Guid dataModelID, GridDataType gridDataType, ISubGridsPipelinedReponseBase response, IFilterSet filters, DesignOffset cutFillDesign, ITRexTask task, ISubGridPipelineBase pipeline, IRequestAnalyser requestAnalyser, bool requireSurveyedSurfaceInformation, bool requestRequiresAccessToDesignFileExistenceMap, BoundingIntegerExtent2D overrideSpatialCellRestriction, ILiftParameters liftParams) { return(new PipelineProcessor <TSubGridsRequestArgument> (requestDescriptor, dataModelID, gridDataType, response, filters, cutFillDesign, task, pipeline, requestAnalyser, requireSurveyedSurfaceInformation, requestRequiresAccessToDesignFileExistenceMap, overrideSpatialCellRestriction, liftParams) as IPipelineProcessor); }
public async Task SimpleSurface_EmptySiteModel_AwayFromDesignCoverage_DefaultCellSize_FullExtent() { AddDesignProfilerGridRouting(); var siteModel = DITAGFileAndSubGridRequestsWithIgniteFixture.NewEmptyModel(); var designUid = DITAGFileAndSubGridRequestsWithIgniteFixture.ConstructSingleFlatTriangleDesignAboutOrigin(ref siteModel, 100.0f); var refeenceDesign = new DesignOffset(designUid, 0); var req = new DesignFilterSubGridMaskRequest(); var response = await req.ExecuteAsync(new DesignSubGridFilterMaskArgument (siteModel.ID, SubGridTreeConsts.DefaultIndexOriginOffset + 10000, // Cell address of originX, about 3km from location of triangle at origin SubGridTreeConsts.DefaultIndexOriginOffset + 10000, // Cell address of originY, about 3km from location of triangle at origin refeenceDesign, siteModel.CellSize)); response.Should().NotBeNull(); response.RequestResult.Should().Be(DesignProfilerRequestResult.NoElevationsInRequestedPatch); response.Bits.Should().BeNull(); }
public async Task SimpleSurface_EmptySiteModel_AtOrigin_DefaultCellSize_FullExtent() { AddDesignProfilerGridRouting(); var siteModel = DITAGFileAndSubGridRequestsWithIgniteFixture.NewEmptyModel(); var designUid = DITAGFileAndSubGridRequestsWithIgniteFixture.ConstructSingleFlatTriangleDesignAboutOrigin(ref siteModel, 100.0f); var referenceDesign = new DesignOffset(designUid, 0); var req = new DesignFilterSubGridMaskRequest(); var response = await req.ExecuteAsync(new DesignSubGridFilterMaskArgument (siteModel.ID, SubGridTreeConsts.DefaultIndexOriginOffset, // Cell address of originX, SubGridTreeConsts.DefaultIndexOriginOffset, // Cell address of originY referenceDesign, siteModel.CellSize)); response.Should().NotBeNull(); response.RequestResult.Should().Be(DesignProfilerRequestResult.OK); response.Bits.CountBits().Should().Be(903); }
/// <summary> /// Performs execution business logic for this executor /// </summary> public IClientHeightLeafSubGrid Execute(ISiteModelBase siteModel, DesignOffset referenceDesign, double cellSize, int originX, int originY, out DesignProfilerRequestResult calcResult) { // Perform the design elevation patch calculation try { /* Test code to force all sub grids to have 0 elevations from a design * ClientHeightLeafSubGrid test = new ClientHeightLeafSubGrid(null, null, 6, 0.34, SubGridTreeConsts.DefaultIndexOriginOffset); * test.SetToZeroHeight(); * return test; */ // Calculate the patch of elevations and return it return(Calc(siteModel, referenceDesign, cellSize, originX, originY, out calcResult)); } finally { //if Debug_PerformDPServiceRequestHighRateLogging then //Log.LogInformation($"#Out# {nameof(CalculateDesignElevationPatch)}.Execute #Result# {calcResult}"); } }
public async Task Test_AlignmentDesignStationRangeRequest() { AddDesignProfilerGridRouting(); var siteModel = DITAGFileAndSubGridRequestsWithIgniteFixture.NewEmptyModel(); var designUid = DITAGFileAndSubGridRequestsWithIgniteFixture.AddSVLAlignmentDesignToSiteModel(ref siteModel, TestHelper.CommonTestDataPath, "Large Sites Road - Trimble Road.svl"); var referenceDesign = new DesignOffset(designUid, 0); var request = new AlignmentDesignStationRangeRequest(); var response = await request.ExecuteAsync(new DesignSubGridRequestArgumentBase { ProjectID = siteModel.ID, ReferenceDesign = referenceDesign, Filters = new FilterSet(new CombinedFilter()), TRexNodeID = Guid.NewGuid() }); // TODO To complete this test later once an alignment design implementation becomes available on a .Net standard version of the Symphony SDK response.RequestResult.Should().Be(DesignProfilerRequestResult.OK); }
public CellDatumRequestArgument_ClusterCompute( Guid siteModelID, DisplayMode mode, XYZ neeCoords, int otgCellX, int otgCellY, IFilterSet filters, DesignOffset referenceDesign, IOverrideParameters overrides, ILiftParameters liftParams) { ProjectID = siteModelID; Mode = mode; NEECoords = neeCoords; OTGCellX = otgCellX; OTGCellY = otgCellY; Filters = filters; ReferenceDesign = referenceDesign; Overrides = overrides; LiftParams = liftParams; }