Created
June 15, 2018 17:36
-
-
Save felipebaltazar/3ebe81a2aad0e1db0c1814afbc00852a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private IEnumerable<Layer> BuildAggregateDimensionLayer(string entityId, Dimension dimension, IEnumerable<DimensionAnalysisResult> dimensionResults) | |
{ | |
if (dimensionResults.Any()) | |
{ | |
var entityInformation = LibraryInformationFetcher.FetchEntityInformation(entityId); | |
if (entityInformation?.Dimensions != null) | |
{ | |
var insertDimension = entityInformation.Dimensions.Insert; | |
if (dimension != null) | |
{ | |
if((!dimension.HasWidth || !dimension.HasDepth || !dimension.HasHeight) | |
&& entityInformation.Dimensions.Dimensions != null) | |
{ | |
var newDimensions = entityInformation.Dimensions.Dimensions.Select(d=> | |
{ | |
return new Dimension( | |
d.HasWidth ? d.Width : dimension.HasWidth ? dimension.Width : insertDimension?.Width, | |
d.HasHeight ? d.Height : dimension.HasHeight ? dimension.Height : insertDimension?.Height, | |
d.HasDepth ? d.Depth : dimension.HasDepth ? dimension.Depth : insertDimension?.Depth, | |
d?.Variables.ToArray()); | |
}).ToArray(); | |
yield return new DimensionLayer(newDimensions); | |
} | |
var newDimension = new Dimension( | |
dimension.HasWidth ? dimension.Width : insertDimension?.Width, | |
dimension.HasHeight ? dimension.Height : insertDimension?.Height, | |
dimension.HasDepth ? dimension.Depth : insertDimension?.Depth, | |
insertDimension?.Variables.ToArray()); | |
yield return new DimensionLayer(new Dimension[] { newDimension }); | |
} | |
else if (insertDimension != null) | |
{ | |
yield return new DimensionLayer(new Dimension[] { insertDimension }); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment