public void Test_ComputeCCAPalette_Details() { const byte TARGET_CCA = 5; var siteModel = BuildModelForSingleCellCCA(CCA_INCREMENT, TARGET_CCA); var filter = new CellPassAttributeFilter() { MachinesList = new []{ siteModel.Machines[0].ID }, LayerID = LAYER_ID }; var ccaPalette = Utilities.ComputeCCAPalette(siteModel, filter, DisplayMode.CCA) as CCAPalette; ccaPalette.Should().NotBe(null); ccaPalette.PaletteTransitions.Length.Should().Be(TARGET_CCA); // The first colour... ccaPalette.PaletteTransitions[0].Color.R.Should().Be(192); ccaPalette.PaletteTransitions[0].Color.G.Should().Be(192); ccaPalette.PaletteTransitions[0].Color.B.Should().Be(0); // The second colour... ccaPalette.PaletteTransitions[1].Color.R.Should().Be(255); ccaPalette.PaletteTransitions[1].Color.G.Should().Be(0); ccaPalette.PaletteTransitions[1].Color.B.Should().Be(0); // The third colour... ccaPalette.PaletteTransitions[2].Color.R.Should().Be(0); ccaPalette.PaletteTransitions[2].Color.G.Should().Be(255); ccaPalette.PaletteTransitions[2].Color.B.Should().Be(255); // The fourth colour... ccaPalette.PaletteTransitions[3].Color.R.Should().Be(0); ccaPalette.PaletteTransitions[3].Color.G.Should().Be(192); ccaPalette.PaletteTransitions[3].Color.B.Should().Be(192); // The fifth colour... ccaPalette.PaletteTransitions[4].Color.R.Should().Be(0); ccaPalette.PaletteTransitions[4].Color.G.Should().Be(128); ccaPalette.PaletteTransitions[4].Color.B.Should().Be(0); }
public void Test_ComputeCCAPalette_Summary() { const byte TARGET_CCA = 5; var siteModel = BuildModelForSingleCellCCA(CCA_INCREMENT, TARGET_CCA); var filter = new CellPassAttributeFilter() { MachinesList = new[] {siteModel.Machines[0].ID}, LayerID = LAYER_ID }; var ccaSummaryPalette = Utilities.ComputeCCAPalette(siteModel, filter, DisplayMode.CCASummary) as CCASummaryPalette; ccaSummaryPalette.Should().NotBe(null); // The undercompacted colour... ccaSummaryPalette.UndercompactedColour.R.Should().Be(192); ccaSummaryPalette.UndercompactedColour.G.Should().Be(192); ccaSummaryPalette.UndercompactedColour.B.Should().Be(0); // The compacted colour... ccaSummaryPalette.CompactedColour.R.Should().Be(255); ccaSummaryPalette.CompactedColour.G.Should().Be(0); ccaSummaryPalette.CompactedColour.B.Should().Be(0); // The overcompacted colour... ccaSummaryPalette.OvercompactedColour.R.Should().Be(0); ccaSummaryPalette.OvercompactedColour.G.Should().Be(255); ccaSummaryPalette.OvercompactedColour.B.Should().Be(255); }
public void Test_CellPassAttributeFilter_CellPassAttributeFilter() { CellPassAttributeFilter filter = new CellPassAttributeFilter(); Assert.False(filter.AnyFilterSelections || filter.AnyMachineEventFilterSelections || filter.AnyNonMachineEventFilterSelections, "Filter flags set for default filter"); }
public void Test_CellPassAttributeFilter_InitialiseMachineIDsSet() { CellPassAttributeFilter filter = new CellPassAttributeFilter(); Assert.False(filter.HasMachineFilter, "Machine filter set"); Assert.True(filter.MachinesList == null || filter.MachinesList.Length == 0, "Machine filter contains machines"); }
public void Test_CellPassAttributeFilter_IsTimeRangeFilter() { CellPassAttributeFilter filter = new CellPassAttributeFilter(); Assert.False(filter.IsTimeRangeFilter(), "Time range set"); filter.HasTimeFilter = true; Assert.False(filter.IsTimeRangeFilter(), "Time range set"); filter.StartTime = DateTime.SpecifyKind(new DateTime(2000, 1, 1), DateTimeKind.Utc); Assert.True(filter.IsTimeRangeFilter(), "Time range not set"); }
private void Test_CellPassAttributeFilter_ClearFilter_Aspect (string name, Action <CellPassAttributeFilter> setState, Func <CellPassAttributeFilter, bool> checkSetState, Action <CellPassAttributeFilter> clearState, Func <CellPassAttributeFilter, bool> checkClearState) { CellPassAttributeFilter filter = new CellPassAttributeFilter(); Assert.True(checkClearState(filter), $"[{name}] State set when expected to be not set (1)"); setState(filter); Assert.True(checkSetState(filter), $"[{name}] State not set when expected to be set"); clearState(filter); Assert.True(checkClearState(filter), $"[{name}] State set when expected to be not set (2)"); }
public async Task Test_TileRenderRequest_SiteModelWithSingleCell_FullExtents(DisplayMode displayMode) { AddApplicationGridRouting(); AddClusterComputeGridRouting(); var siteModel = BuildModelForSingleCellTileRender(HEIGHT_INCREMENT_0_5, CCV_INCREMENT); var request = new TileRenderRequest(); var filter = new CellPassAttributeFilter() { MachinesList = new[] { siteModel.Machines[0].ID }, LayerID = 1 }; var response = await request.ExecuteAsync(SimpleTileRequestArgument(siteModel, displayMode, null, filter)); CheckSimpleRenderTileResponse(response); }
private void Test_CellPassAttributeFilter_ClearFilterAll_CheckByAspect(Action <CellPassAttributeFilter, bool> setAspect, Func <CellPassAttributeFilter, bool> getAspect) { CellPassAttributeFilter filter = new CellPassAttributeFilter(); filter.AnyFilterSelections.Should().BeFalse(); getAspect.Invoke(filter).Should().BeFalse(); setAspect.Invoke(filter, true); filter.AnyFilterSelections.Should().BeTrue(); getAspect.Invoke(filter).Should().BeTrue(); filter.HasTimeFilter = true; filter.ClearFilter(); filter.AnyFilterSelections.Should().BeFalse(); filter.HasTimeFilter.Should().BeFalse(); }
public void Test_CellPassAttributeFilter_Assign() { CellPassAttributeFilter filter1 = new CellPassAttributeFilter(); CellPassAttributeFilter filter2 = new CellPassAttributeFilter(); filter1.ClearFilter(); filter2.ClearFilter(); filter1.MaterialTemperatureMin = 10; filter1.MaterialTemperatureMax = 30; filter1.HasTemperatureRangeFilter = true; filter1.FilterTemperatureByLastPass = true; filter1.MachinesList = new Guid[] { Guid.NewGuid(), Guid.NewGuid(), }; //Assert.Equal(-1, filter1.CompareTo(filter2)); filter2.Assign(filter1); //Assert.Equal(0, filter1.CompareTo(filter2)); filter1.Should().BeEquivalentTo(filter2); }
public async Task Test_CellPassesRequest_WithLiftFilter(int layerId) { AddApplicationGridRouting(); AddClusterComputeGridRouting(); var baseTime = DateTime.UtcNow; var siteModel = BuildModelForSingleCellLiftAnalysis(baseTime); var request = new CellPassesRequest_ClusterCompute(); var arg = CreateRequestArgument(siteModel); var attributeFilter = new CellPassAttributeFilter { HasLayerStateFilter = true, LayerState = LayerState.On, HasLayerIDFilter = true, LayerID = layerId }; arg.Filters = new FilterSet(new CombinedFilter { AttributeFilter = attributeFilter, SpatialFilter = new CellSpatialFilter() }); var response = await request.ExecuteAsync(arg, new SubGridSpatialAffinityKey(SubGridSpatialAffinityKey.DEFAULT_SPATIAL_AFFINITY_VERSION_NUMBER_TICKS, arg.ProjectID, arg.OTGCellX, arg.OTGCellY)); //There should be one layer with 5 cell passes. The other layer and its cell passes should be excluded. response.Should().NotBeNull(); response.ReturnCode.Should().Be(CellPassesReturnCode.DataFound); response.CellPasses.Count.Should().Be(5); for (var idx = 0; idx < 5; idx++) { var mockModifier = idx + (layerId == LAYER_ID1 ? 1 : 6); var expectedTime = baseTime.AddMinutes(mockModifier); var expectedHeight = 1.0f + mockModifier * 0.5f; var expectedCcv = (short)(10 + 10 * mockModifier); var cellPass = response.CellPasses[idx]; cellPass.LastPassValidCCV.Should().Be(expectedCcv); cellPass.LastPassTime.Should().Be(expectedTime); cellPass.Height.Should().Be(expectedHeight); cellPass.LayersCount.Should().Be(1); } }
public void Test_CellPassAttributeFilter_Prepare() { CellPassAttributeFilter filter = new CellPassAttributeFilter(); filter.ClearFilter(); Assert.False(filter.AnyFilterSelections, "AnyFilterSelections not false"); Assert.False(filter.AnyMachineEventFilterSelections, "AnyMachineEventFilterSelections not false"); Assert.False(filter.AnyNonMachineEventFilterSelections, "AnyNonMachineEventFilterSelections not false"); filter.HasTimeFilter = true; Assert.True(filter.AnyFilterSelections, "AnyFilterSelections not true after adding time filter"); Assert.False(filter.AnyMachineEventFilterSelections, "AnyMachineEventFilterSelections not false"); Assert.True(filter.AnyNonMachineEventFilterSelections, "AnyNonMachineEventFilterSelections not true after adding time filter"); filter.ClearFilter(); filter.HasPositioningTechFilter = true; Assert.True(filter.AnyFilterSelections, "AnyFilterSelections not true"); Assert.True(filter.AnyMachineEventFilterSelections, "AnyMachineEventFilterSelections not true"); Assert.False(filter.AnyNonMachineEventFilterSelections, "AnyNonMachineEventFilterSelections true"); }
/// <summary> /// Default no-arg constructor /// </summary> public CombinedFilter() { AttributeFilter = new CellPassAttributeFilter(); SpatialFilter = new CellSpatialFilter(); }
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)); }
public ICellPassAttributeFilter Resolve(FilterResult src, CombinedFilter dst, ICellPassAttributeFilter member, ResolutionContext context) { var filter = new CellPassAttributeFilter(); if (src == null) { return(filter); } if (src.StartUtc.HasValue) { filter.StartTime = src.StartUtc.Value; filter.HasTimeFilter = true; } if (src.EndUtc.HasValue) { filter.EndTime = src.EndUtc.Value; filter.HasTimeFilter = true; } //src.OnMachineDesignName - Can't do this in TRex at present filter.HasDesignFilter = src.OnMachineDesignId.HasValue; if (filter.HasDesignFilter) { filter.DesignNameID = (int)(src.OnMachineDesignId.Value); } filter.HasMachineFilter = src.ContributingMachines != null && src.ContributingMachines.Count > 0; if (filter.HasMachineFilter) { filter.MachinesList = src.ContributingMachines.Where(m => m.AssetUid.HasValue) .Select(m => m.AssetUid.Value).ToArray(); } if (src.CompactorDataOnly.HasValue) { filter.HasCompactionMachinesOnlyFilter = src.CompactorDataOnly.Value; } filter.HasVibeStateFilter = src.VibeStateOn.HasValue; if (filter.HasVibeStateFilter) { filter.VibeState = src.VibeStateOn.Value ? VibrationState.On : VibrationState.Off; } filter.HasElevationTypeFilter = src.ElevationType.HasValue; if (filter.HasElevationTypeFilter) { filter.ElevationType = (ElevationType)src.ElevationType.Value; } filter.HasMachineDirectionFilter = src.ForwardDirection.HasValue; if (filter.HasMachineDirectionFilter) { filter.MachineDirection = src.ForwardDirection.Value ? MachineDirection.Forward : MachineDirection.Reverse; } // Layer Analysis filter.HasLayerStateFilter = src.LayerType.HasValue; if (filter.HasLayerStateFilter) { //filter.LayerMethod is used to set LiftSettings.LiftDetectionType elsewhere. LayerMethod is not in the TRex filter. filter.LayerState = LayerState.On; if (src.LayerType == FilterLayerMethod.OffsetFromDesign || src.LayerType == FilterLayerMethod.OffsetFromBench || src.LayerType == FilterLayerMethod.OffsetFromProfile) { if (src.LayerType == FilterLayerMethod.OffsetFromBench) { filter.ElevationRangeLevel = src.BenchElevation.HasValue ? src.BenchElevation.Value : 0; } else { filter.ElevationRangeDesign = new DesignOffset(src.LayerDesignOrAlignmentFile.FileUid.Value, src.LayerDesignOrAlignmentFile.Offset); } if (src.LayerNumber.HasValue && src.LayerThickness.HasValue) { int layerNumber = src.LayerNumber.Value < 0 ? src.LayerNumber.Value + 1 : src.LayerNumber.Value; filter.ElevationRangeOffset = layerNumber * src.LayerThickness.Value; filter.ElevationRangeThickness = src.LayerThickness.Value; } else { filter.ElevationRangeOffset = 0; filter.ElevationRangeThickness = 0; } filter.HasElevationRangeFilter = true; } else if (src.LayerType == FilterLayerMethod.TagfileLayerNumber) { filter.LayerID = src.LayerNumber.Value; filter.HasLayerIDFilter = true; } } else { filter.LayerState = LayerState.Off; } filter.HasGPSAccuracyFilter = src.GpsAccuracy.HasValue; if (filter.HasGPSAccuracyFilter) { filter.GPSAccuracy = (GPSAccuracy)src.GpsAccuracy; filter.GPSAccuracyIsInclusive = src.GpsAccuracyIsInclusive ?? false; } if (src.BladeOnGround.HasValue && src.BladeOnGround.Value) { filter.HasPassTypeFilter = true; filter.PassTypeSet |= PassTypeSet.Front; filter.PassTypeSet |= PassTypeSet.Rear; } if (src.TrackMapping.HasValue && src.TrackMapping.Value) { filter.HasPassTypeFilter = true; filter.PassTypeSet |= PassTypeSet.Track; } if (src.WheelTracking.HasValue && src.WheelTracking.Value) { filter.HasPassTypeFilter = true; filter.PassTypeSet |= PassTypeSet.Wheel; } if (src.ExcludedSurveyedSurfaceUids != null) { filter.SurveyedSurfaceExclusionList = src.ExcludedSurveyedSurfaceUids.ToArray(); } filter.ReturnEarliestFilteredCellPass = src.ReturnEarliest.HasValue && src.ReturnEarliest.Value; filter.HasGCSGuidanceModeFilter = src.AutomaticsType.HasValue; if (filter.HasGCSGuidanceModeFilter) { filter.GCSGuidanceMode = (AutomaticsType)src.AutomaticsType.Value; } filter.HasTemperatureRangeFilter = src.TemperatureRangeMin.HasValue && src.TemperatureRangeMax.HasValue; if (filter.HasTemperatureRangeFilter) { filter.MaterialTemperatureMin = (ushort)(src.TemperatureRangeMin.Value * 10); filter.MaterialTemperatureMax = (ushort)(src.TemperatureRangeMax.Value * 10); } filter.HasPassCountRangeFilter = src.PassCountRangeMin.HasValue && src.PassCountRangeMax.HasValue; if (filter.HasPassCountRangeFilter) { filter.PassCountRangeMin = (ushort)src.PassCountRangeMin.Value; filter.PassCountRangeMax = (ushort)src.PassCountRangeMax.Value; } //These are not used? //HasElevationMappingModeFilter //HasPositioningTechFilter return(filter); }